package com.cz.datafetcher.controller;

import com.cz.datafetcher.common.CommonReturn;
import com.cz.datafetcher.common.SysError;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/index")
public class IndexController {

    @GetMapping("/test1")
    public List<String> test1(){
        List<String> strings = new ArrayList<>();
        strings.add("a");
        strings.add("b");
        strings.add("c");
        strings.add("d");
        return strings;
    }

    @GetMapping("/test2")
    public String test2() throws SysError {
        throw new SysError("lalala");
        //return "err";
    }

    @GetMapping("/test3")
    public String test3(){
        int x=10/0;
        return "a";
    }
    @GetMapping("/test4")
    public CommonReturn test4(){
        return CommonReturn.ok("abc");
    }

}
